package com.ruoyi.hqfinance.service.impl;

import com.github.pagehelper.PageHelper;
import com.ruoyi.hqfinance.domain.HqTransferExamineSettleSheet;
import com.ruoyi.hqfinance.domain.vo.HqTransferExamineSettleSheetVo;
import com.ruoyi.hqfinance.mapper.HqTransferExamineSettleSheetMapper;
import com.ruoyi.hqfinance.service.HqTransferExamineSettleSheetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HqTransferExamineSettleSheetServiceImpl implements HqTransferExamineSettleSheetService {
    @Autowired
    private HqTransferExamineSettleSheetMapper hqTransferExamineSettleSheetMapper;
    @Override
    public List<HqTransferExamineSettleSheet> collect(HqTransferExamineSettleSheetVo vo) {
        PageHelper.startPage(vo.getDateType());
        List<HqTransferExamineSettleSheet> sheets = hqTransferExamineSettleSheetMapper.collect(vo);
        assert sheets != null;
        for (HqTransferExamineSettleSheet hqTransferExamineSettleSheet : sheets){
            if (vo.getTimeType() == 2){
                hqTransferExamineSettleSheet.setSettleDate(vo.getStartTime() + "至" + vo.getEndTime());
            }
        }
        return sheets;
    }
}
